package baseTest;

import java.util.Scanner;

public class multiple {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i < n; i++) {
            if (i % 7 == 0) {
                System.out.println(i);
            } else {
                int m = i;
                while (m > 0) {
                    if (m % 10 == 7) {
                        System.out.println(i);
                    }
                    m = m / 10;
                }
            }
        }
    }
}
